package com.util;

import com.bean.Group;
import com.bean.User;

public class QQUtils {
	
	/**
	 * 生成qq号
	 * @return
	 */
	public static String genQQnum(){
		StringBuffer sb = new StringBuffer();
		int one=(int)(Math.random()*10);
		sb.append(one);
		int two=(int)(Math.random()*10);
		sb.append(two);
		int three=(int)(Math.random()*10);
		sb.append(three);
		int four=(int)(Math.random()*10);
		sb.append(four);
		int five=(int)(Math.random()*10);
		sb.append(five);
		int six=(int)(Math.random()*10);
		sb.append(six);
		int seven=(int)(Math.random()*10);
		sb.append(seven);
		return sb.toString();
	}

	/**
	 * 生成qq头像
	 * @return
	 */
	public static String genQQHeader(){
		int pic=(int)(Math.random()*10);
		return pic+".png";
	}

	/**
	 * 获取群主
	 * @param userId
	 * @param group
	 * @return
	 */
	public static String getQunzhu(int userId, Group group){
		String s="";
		for (User user : group.getUserList()){
			if(user.getId()==userId){
				s= user.getUsername()+":"+user.getQq();
				return s;
			}
		}
		return s;
	}

}
